import http from '@/utils/http'

export const getList = (params) => {
  return async (dispatch) => {
    const res = await http.get('/sys/user', { params })
    dispatch({
      type: 'Employees/getList',
      payload: {
        ...res.data.data,
        current: params.page,
        pageSize: params.size,
      },
    })
  }
}

//删除员工
export const delEmp = (id) => {
  return async () => {
    await http.delete(`/sys/user/${id}`)
  }
}

//添加员工
export const addEmp = (data) => {
  return async () => {
    const res = await http.post('/sys/user', data)
    console.log(res)
  }
}
